#include"String.h"

/////////////////
//include
/////////////////
#include<stack>
/////////////////
//prottype
/////////////////

/////////////////
//const
/////////////////
namespace ANX
{

	String::String()
	{

	}
	String::~String()
	{

	}

	Array<std::string> String::Splite(char split_char)
	{
		const	char* tmp_char = this->c_str();
		int array_count = 1;
		for(int i = 0;i < this->size();i++)
		{
			if(strcmp(&split_char,&tmp_char[i]))
			{
				array_count ++;
			}
		}
		Array<std::string> tmp_array = Array<std::string>();
		int set_count = 0;
		std::string tmp_string = "";
		for(int i = 0;i < this->size();i++)
		{	
			if(strcmp(&split_char,&tmp_char[i]))
			{
				tmp_array[set_count] = tmp_string;
				tmp_string = "";
				set_count++;
			}
			tmp_string += tmp_char[i];
		}
		return tmp_array;
	}
	int String::ToInt()
	{
		const char* tmp_char = c_str();
		std::stack<char> char_stack;
		for(int i = 0;i<this->size();i++)
		{
			char_stack.push(tmp_char[i]);
		}
		int tmp_num = 0;
		for(int i = 0;i<this->size();i++)
		{
			tmp_num = char_stack.top() - 48;
			tmp_num *= 10;
			char_stack.pop();
		}
		return tmp_num;
	}
};